<template>
	<view class="wx-index">
		<image class="wx-bg" src="../../static/wx/bg.png" mode="aspectFill"></image>
		<view class="wx-btns">
			<view class="wx-btn wx-btn-info" @click="goLogin">登录</view>
			<view class="wx-btn wx-btn-normal" v-if="is_register == 1" @click="goRegister">注册</view>
		</view>
	</view>
</template>
<script>
	var app = getApp();
	export default {
		data() {
			return {
				is_register: app.globalData.appconfig ? app.globalData.appconfig.member_allow_register : 0,
			}
		},
		onLoad() {
			if(this.$fc.is_empty(app.globalData.appconfig)){
				this.reloadconfig();
			}
		},
		methods: {
		    reloadconfig(){
		          if(this.$fc.is_empty(app.globalData.appconfig)){
		              setTimeout(()=>{
		                  this.reloadconfig();
		              },500);
		          }else{
		              this.is_register = app.globalData.appconfig.member_allow_register;
		          }
		    },  
			goLogin(){
				uni.navigateTo({
					url:this.$fc.get_package_name()+'login/index'
				})
			},
			goRegister(){
				if(this.is_register != 1){
					return;
				}
				uni.navigateTo({
					url:this.$fc.get_package_name()+'register/index'
				})
			}
		}
	}
</script>

<style scoped>
	.wx-index{
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		position: relative;
	}
	.wx-btns{display: flex;flex-direction: row;align-items: center;justify-content: space-between;position: absolute;width: 100%;bottom: 40rpx;padding:0 34rpx;box-sizing: border-box;}
	.wx-btn{
		width: 200rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 12rpx;
		background-color: #007AFF;
		color: #fff;
		font-size: 32rpx;
	}
	.wx-btn-info{
		background-color: #05C160;
	}
	.wx-btn-normal{
		background-color: #ffffff;
		color: #000000;
	}
	.wx-bg{
		width: 100vw;
		height: 100vh;
	}
</style>
